import request from "@/utils/request"
import store from '../store'
export default {
    findOption(){
        return request({
            url:'http://39.106.83.184:9002/score/findOption',
            method:'get'
        })
    },
    findById(id) {
        return request({
            url: `http://39.106.83.184:9002/score/findById/${id}`,
            method: 'get'
        })
    },
    save(option){
        //pojo.token = store.getters.token
        return request({
            url: 'http://39.106.83.184:9002/score/addOption',
            method: 'post',
            data: option
        })    
    },
    
    saveOrUpdate(id, option){
        if(id != undefined && id != null && id != ''){
            return this.update(id,option);
        }else{
            return this.save(option);
        }
    },
    update(id,option) {
        return request({
            url: `http://39.106.83.184:9002/score/updateOption/${id}`,
            method: 'put',
            data: option
        })
    },
    delete(id){
        //pojo.token = store.getters.token
        return request({
            url: `http://39.106.83.184:9002/score/${id}`,
            method: 'delete'
        })    
    },
    
}